import java.util.Scanner;

public class P1425 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a,b,c,d,e,f;
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        d = sc.nextInt();
        if(a<=c){
            e=c-a;
        }
        else{
            e=24-a+c;
        }
        if(d<b){
            f=60-b+d;
            e--;
        }else {
            f=d-b;
        }
        System.out.print(e+" "+f);
    }
}
